package com.smartcampus.demo.repository;

import com.smartcampus.demo.domain.Humidity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface HumidityDao extends JpaRepository<Humidity, Long> {

    @Query(value = "SELECT * FROM humidity ORDER BY time DESC LIMIT ?1", nativeQuery = true)
    List<Humidity> findTopNByOrderByCreatedAtDesc(int n);
}
